﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using Business;

namespace QuanLyNhaSach
{
    public partial class frmTheLoai : Form
    {
       
        public frmTheLoai()
        {
            InitializeComponent();
        }

        private void frmTheLoai_Load(object sender, EventArgs e)
        {
            List<TacGiaDTO> li = new List<TacGiaDTO>();
           // li.Add(SachService.GetSachByID(1));
            li.Add(TacGiaService.GetTacGiaByID(1));
            dgvTheLoai.DataSource = li;
           
           /* TheLoaiDTO theloai = new TheLoaiDTO();
            theloai.MaTheLoai = 1;
            theloai.TenTheLoai = "Công Nghệ Thông Tin";
            TheLoaiService theloaisv = new TheLoaiService();
            theloaisv.Update(theloai);
            List<TheLoaiDTO> ltheloai = TheLoaiRepository.GetAllTheLoai();
            dgvTheLoai.DataSource = ltheloai;*/
          
           /* dgvTheLoai.ColumnCount = 2;
            dgvTheLoai.Columns[0].Name = "MaTheLoai";
            dgvTheLoai.Columns[1].Name = "TenTheLoai";*/
          /*  foreach (TheLoaiDTO tl in ltheloai)
            {
                DataGridViewRow row = new DataGridViewRow();
               
                row.Cells[0].Value = tl.MaTheLoai.ToString();
                row.Cells[1].Value = tl.TenTheLoai.ToString();
                dgvTheLoai.Rows.Add(row);
            }*/
          //  dgvTheLoai.Rows.Add();
            
           // dgvTheLoai.DataSource = ltheloai;
            //DataGridViewRow row = new DataGridViewRow();
           
            

           
        }

        

        

        private void dgvTheLoai_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
           
          //  MessageBox.Show("Cellenter");xay ra khi chuyen qua lai giua cac cell
        }

        private void dgvTheLoai_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
           // MessageBox.Show("DongDaThem");Dong duoc them vao datagridview
        }

        private void dgvTheLoai_UserAddedRow(object sender, DataGridViewRowEventArgs e)
        {
            MessageBox.Show("NguoiDungThemMotDong"); 
        }

        private void dgvTheLoai_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
          //  MessageBox.Show("cellendedit");ket thuc viec ghi du lieu cua o
        }

        private void dgvTheLoai_CellContextMenuStripChanged(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show("CellContextMenuStripChanged");
        }

        private void dgvTheLoai_Enter(object sender, EventArgs e)
        {
            MessageBox.Show("enter"); //datagridview duoc load len
        //   dgvTheLoai.Rows.Add();
            
        }

        

        private void dgvTheLoai_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
        {
           // MessageBox.Show("cellparsing");chuyen qua cell khac
        }

        private void dgvTheLoai_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show("cellvaluechanged");//ngay sau khi cellparsing thi gia tri cell duoc thay doi
        }

        private void dgvTheLoai_NewRowNeeded(object sender, DataGridViewRowEventArgs e)
        {
            MessageBox.Show("newrowneeded");
        }

        private void dgvTheLoai_SelectionChanged(object sender, EventArgs e)
        {
            //MessageBox.Show("selectionchanged");Mot cell duoc chon
        }

        private void dgvTheLoai_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
        {
            MessageBox.Show("rowsremoved");
        }

        private void dgvTheLoai_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            //MessageBox.Show("rowenter");chuyen qua lai giua cac dong
        }

        private void dgvTheLoai_Click(object sender, EventArgs e)
        {
            MessageBox.Show("click/Tren datagridview");
        }

        private void dgvTheLoai_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            MessageBox.Show("cellmouseclick");
        }

        private void dgvTheLoai_MouseEnter(object sender, EventArgs e)
        {
           
             MessageBox.Show("mouseenter/khirechuotvaodatagrid");
        }

        private void dgvTheLoai_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show("cellcontentclick");
        }

       

        private void dgvTheLoai_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            MessageBox.Show("userdeletingrow");
        }

        private void dgvTheLoai_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            //MessageBox.Show("cellbeginedits");Bat dau them du lieu vao cell
        }

        private void dgvTheLoai_ColumnAdded(object sender, DataGridViewColumnEventArgs e)
        {
           // MessageBox.Show("columnadded");cac cot dinh nghia cua datagridview duoc them vao
        }

       
        

       
       
    }
}
